#ifndef QUATERNION_H
#define QUATERNION_H

#include "Vec3.h"

namespace Engine
{
	class Matrix;

	class Quaternion  
	{
		private:
			float m_w;
			float m_x;
			float m_y;
			float m_z;
	
		public:
			friend class Matrix;

			Quaternion():m_w(1.0f), m_x(0.0f), m_y(0.0f), m_z(0.0f){}
			Quaternion(float angleDeg, const Vec3& axis);
		
			void Normalise();
		
			// Convert to column-major Matrix
			void ToMatrix(float matrix[16]) const;
		
			// Interpolate between two Quaternions
			// 0 <= t <= 1
			friend Quaternion Slerp(const Quaternion& q1, 
				                    const Quaternion& q2, 
											    float t);
		
			friend Quaternion operator*(const Quaternion& q1, const Quaternion& q2);
		
			float GetX() const {return m_x;}
			float GetY() const {return m_y;}
			float GetZ() const {return m_z;}
		
			Quaternion Conjugate() const;

			Vec3 RotateVec(const Vec3& v) const;
	};
}

#endif 